package com.acme.bankapp.domain.bank;


import com.acme.bankapp.domain.bank.client.Client;

/**
 * This class represents bank
 *
 * @author Alexander Kotov
 */

public class Bank {
    private Client[] clients;

    /**
     * @return list of bank clients
     */
    public Client[] getClients() {
        if (clients == null) {
            return null;
        }
        Client[] retClients = new Client[clients.length];
        System.arraycopy(clients, 0, retClients, 0, clients.length);
        return retClients;
    }

    /**
     * This method for add client object to bank object
     *
     * @param client represents {@link Client} object
     */
    public void addClient(Client client) {
        if (clients == null) {
            clients = new Client[1];
            clients[0] = client;
        } else {
            Client[] newClients = new Client[clients.length + 1];
            System.arraycopy(clients, 0, newClients, 0, clients.length);
            newClients[clients.length] = client;
            clients = newClients;
        }
    }
}
